package com.xueyi.aixihu.entity.vo;

import com.xueyi.aixihu.entity.po.AxhFinanceReportCommunity;
import com.xueyi.aixihu.entity.po.AxhFinanceReportVillage;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.util.StringUtils;

/**
 * 描述 导入到社区到Vo
 *
 * @auther 俞烨
 * @date 2022-08-16 14
 */
@Data
@NoArgsConstructor
public class ExportCommunityVo {

    private ExportCommunityVo parentVo;     // 父
    private ExportCommunityVo lastVo;       // 上一个
    private ExportCommunityVo nextVo;       // 下一个
    private FinanceReportBase item; // 当前数据
    private ExportCommunityVo sonCom;       // 子

    public ExportCommunityVo(FinanceReportBase item) {
        if(StringUtils.isEmpty(item.getLineName())) {
            item.setLineName(item.getLineName().replaceAll(" " , ""));
        }
        this.item = item;
    }

    public ExportCommunityVo(ExportCommunityVo parentVo, AxhFinanceReportCommunity item) {
        this.parentVo = parentVo;
        this.item = item;
    }

    public String toString() {
        if (item instanceof AxhFinanceReportCommunity) {
            AxhFinanceReportCommunity axhFinanceReportCommunity = (AxhFinanceReportCommunity) item;
            return axhFinanceReportCommunity.getLineName();
        } else {
            AxhFinanceReportVillage axhFinanceReportVillage = (AxhFinanceReportVillage) item;
            return axhFinanceReportVillage.getLineName();
        }
    }
}


